#define _DEFAULT_SOURCE
#include "clog.h"
#include <unistd.h>
#include <stdio.h>

int main() {
    printf("Test App 1 starting...\n");
    
    // 测试不同级别的日志 - 自动初始化
    LOGI("Application started successfully");
    LOGD("Debug information: initializing components");
    LOGW("Warning: configuration file not found, using defaults");
    LOGE("Error: failed to connect to database");
    
    // 循环发送一些日志消息
    for (int i = 0; i < 50; i++) {
        LOGI("Processing item %d", i + 1);
        
        if (i % 10 == 0) {
            LOGD("Checkpoint reached at item %d", i + 1);
        }
        
        if (i % 20 == 0 && i > 0) {
            LOGW("Memory usage is high at item %d", i + 1);
        }
        
        if (i == 30) {
            LOGE("Critical error occurred at item %d", i + 1);
        }
        
        usleep(100000); // 休眠100ms
    }
    
    LOGI("Application completed successfully");
    
    printf("Test App 1 finished.\n");
    return 0;
}
